<template>
  <div>
    <!-- 验证码输入框 -->
    <input type="Number" :maxlength="codeMaxlength" :placeholder="codePlaceholder" :class="codeInputClass" class="c-fs26 c-bd0 c-fc-xblack" v-model="code" @input="checkCode">
  </div>
</template>

<script>
export default {
  name: 'commonInput',
  props: {
    codeMaxlength: {
      type: Number,
      default: 4,
    },
    codePlaceholder: {
      type: String,
      default: '请输入验证码',
    },
    code: {
      type: Number,
      default: 0,
    },
    codeInputClass: {
      type: String,
      default: '',
    }
  },
  computed: {},
  data() {
    return {
      showBackTop: false,
    }
  },

  methods: {
    checkCode() {
      if (this.code.length > this.codeMaxlength) this.code = this.code.slice(0, this.codeMaxlength);
      this.$emit('checkCode')
    },
  },
  mounted() {
  },
  destroyed() {
  }
}
</script>

<style scoped>
</style>
